package com.heima.behavior.config;

import com.heima.behavior.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserInterceptor())  // 添加自定义拦截器
        .addPathPatterns("/**") // 指定需要拦截的路径 /** 表示拦截所有
        ;
    }
}
